import { createRouter, createWebHistory } from 'vue-router';
import { restructureRoutes } from '@/utils/index.js';
import routes from '~pages';
console.log(routes);
// const result = restructureRoutes(routes);
// console.log(result);
// 获取第一个路由的路径
const firstRoutePath = routes[0]?.path || '/';
const router = createRouter({
  // history: createWebHistory(import.meta.env.BASE_URL),
  history: createWebHistory(),
  routes: [
    {
      path: '/',
      redirect: firstRoutePath,
    },
    ...routes,
  ],
});

export default router;
